package net.huashitong.ssydt.provider.exam.service;


import net.huashitong.ssydt.exam.entity.SsExamPaperQuestionRecord;
import net.huashitong.ssydt.provider.exam.mapper.SsExamPaperQuestionRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author <a href="mailto:yhy23456@163.com">huiyang.yu</a>
 * @since 2017.09.04
 */
@Service
@Transactional
public class SsExamPaperQuestionRecordServiceImpl implements SsExamPaperQuestionRecordService {

    private SsExamPaperQuestionRecordMapper mapper;

    @Autowired
    public SsExamPaperQuestionRecordServiceImpl(SsExamPaperQuestionRecordMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public List<SsExamPaperQuestionRecord> findSequenceDescByRecordId(Long paperRecordId) {
        return mapper.findSequenceDescByRecordId(paperRecordId);
    }

    @Override
    public SsExamPaperQuestionRecord getByPaperRecordIdWithQuestionId(Long paperRecordId, Long questionId) {
        SsExamPaperQuestionRecord ssExamPaperQuestionRecord = new SsExamPaperQuestionRecord();
        ssExamPaperQuestionRecord.setPaperRecordId(paperRecordId);
        ssExamPaperQuestionRecord.setQuestionId(questionId);
        return mapper.getByPaperRecordIdWithQuestionId(ssExamPaperQuestionRecord);
    }

    @Override
    public void insertSelective(SsExamPaperQuestionRecord ssExamPaperQuestionRecord) {
        mapper.insertSelective(ssExamPaperQuestionRecord);
    }

    @Override
    public void updateByPrimaryKeySelective(SsExamPaperQuestionRecord ssExamPaperQuestionRecord) {
        mapper.updateByPrimaryKeySelective(ssExamPaperQuestionRecord);
    }
}
